<%--04_empty.jsp--%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    //1、值为null值的时候，为空
    request.setAttribute("emptyNull", null);
    //2、值为空串的时候，为空
    request.setAttribute("emptyStr", "");
    //3、值是Object类型数组，长度为零的时候，为空
    request.setAttribute("emptyArr", new Object[]{});
    //4、list集合，元素个数为零，为空
    List<String> list = new ArrayList<>();
    //list.add("abc");
    request.setAttribute("emptyList", list);
    //5、map集合，元素个数为零，为空
    Map<String,Object> map = new HashMap<String, Object>();
    //map.put("key1", "value1");
    request.setAttribute("emptyMap", map);
%>
    ${ empty emptyNull } <br/>
    ${ empty emptyStr } <br/>
    ${ empty emptyArr } <br/>
    ${ empty emptyList } <br/>
    ${ empty emptyMap } <br/>

    <%-- 支持三元运算 --%>
    ${ empty emptyMap ? "map is null" : "map is not null"}

</body>
</html>
